/**
 * 
 */
package com.jolestar.yayaweibotong.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author jolestar@gmail.com
 * 
 */
public class RedirectAction extends AbstractAction {

	private String target;

	public RedirectAction(String name, String target) {
		super(name);
		this.target = target;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.jolestar.yayaweibotong.controller.WebAction#getPath()
	 */
	@Override
	public String getPath() {
		return "/" + this.getName();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.jolestar.yayaweibotong.controller.AbstractAction#doAction(javax.servlet
	 * .http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
	 */
	@Override
	protected String doAction(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		return "redirect:" + this.target;
	}

}
